
/*
 * Copyright (C) 2006 Sun Microsystems, Inc. All rights reserved. Use is
 * subject to license terms.
 */ 

package com.cainli.task;

import android.view.View;



final class DefaultInputBlocker extends AbstractTask.InputBlocker {

    DefaultInputBlocker(Task task, Task.BlockingScope scope, Object target) {
        super(task, scope, target);
    }

    private void setComponentTargetBlocked(boolean f) {
        View c = (View)getTarget();
        c.setEnabled(!f);
        // Note: can't set the cursor on a disabled component
    }
    

    @Override protected void block() {
        switch (getScope()) {
//        case Task:      
//            setActionTargetBlocked(true); 
//            break;
        case VIEW:   
            setComponentTargetBlocked(true); 
            break;
        case WINDOW:      
        case APPLICATION: 
            // 未实现
            break;
        }
    }

    @Override protected void unblock() {
        switch (getScope()) {
//        case ACTION:      
//            setActionTargetBlocked(false); 
//            break;
        case VIEW:   
            setComponentTargetBlocked(false); 
            break;
        case WINDOW:      
        case APPLICATION: 
            // 未实现
            break;
        }
    }
}
